import { reggetsearchList } from "@/api/index";
import { start } from "nprogress";
const actions = {
    async getsearchlist({ commit }, value = {}) {
        let result = await reggetsearchList(value)
        //打印服务器得到的数据  主要看看是什么类型的数据
        // console.log(result)
        commit("GETSEARCHLIST", result.data)
    }
}
const mutations = {
    GETSEARCHLIST(state, value) {
        state.searchLists = value;
    }
}
const state = {
    searchLists: {}
}
//简化得到的数据 方便后面的应用
const getters = {
    goodsList(state) {
        return state.searchLists.goodsList || [];
    },
    attrsList(state) {
        return state.searchLists.attrsList || [];
    },
    trademarkList(state) {
        return state.searchLists.trademarkList || [];
    }


}

export default {
    namespaced: true,
    //这里用了对象的简写形式：key和value一致 ，可以省略其中一个
    actions,
    mutations,
    state,
    getters

}